WOLF core
WOLF: A Modular Estimation Framework for Robotics
XXXXXXXXXXXXXXXXXXXXXXXXvoid(0)" frameborder="0" name="MSearchResults" id="MSearchResults">
wolf::Problem Class Reference

Wolf problem: root of the wolf tree (hardware, trajectory and map). It manages the motion providers, the first frame, the keyframe callbacks, the covariances and the notifications to the solver manager. More...

#include <core/problem/problem.h>

Inheritance diagram for wolf::Problem:
[legend]

Public Member Functions

virtual ~Problem ()
 Destructor. More...
 
LoaderPtr getLoader ()
 Returns the plugin loader. More...
 
SizeEigen getDim () const
 Returns the dimension of the problem (2 or 3) More...
 
TypeComposite getFrameTypes (StateKeys _keys) const
 Returns the frame state types of some keys. More...
 
void setTreeManager (TreeManagerBasePtr _gm)
 Sets the tree manager. More...
 
TreeManagerBaseConstPtr getTreeManager () const
 Returns the tree manager. More...
 
TreeManagerBasePtr getTreeManager ()
 Returns the tree manager. More...
 
HardwareBaseConstPtr getHardware () const
 Returns the hardware branch. More...
 
HardwareBasePtr getHardware ()
 Returns the hardware branch. More...
 
SensorBasePtr installSensor (YAML::Node _sensor_node, std::vector< std::string > _schema_folders={})
 Installs a sensor (creates it and links it to the hardware) from a YAML node, loading its plugin if needed. More...
 
SensorBasePtr installSensor (const std::string &_params_yaml_filename, std::vector< std::string > _schema_folders)
 Installs a sensor (creates it and links it to the hardware) from a YAML file. More...
 
ProcessorBasePtr installProcessor (YAML::Node _processor_node, std::vector< std::string > _schema_folders={})
 Installs a processor (creates it and links it to the sensor named in 'sensor_name') from a YAML node, loading its plugin if needed. More...
 
ProcessorBasePtr installProcessor (SensorBasePtr _sensor_corresponding, const std::string &_params_yaml_filename, std::vector< std::string > _schema_folders)
 Installs a processor (creates it and links it to the given sensor) from a YAML file. More...
 
ProcessorBasePtr installProcessor (const std::string &_params_yaml_filename, std::vector< std::string > _schema_folders)
 Installs a processor (creates it and links it to the sensor named in 'sensor_name') from a YAML file. More...
 
SensorBaseConstPtr findSensor (const std::string &_sensor_name) const
 Returns the sensor with a given name (nullptr if not found) More...
 
SensorBasePtr findSensor (const std::string &_sensor_name)
 Returns the sensor with a given name (nullptr if not found) More...
 
ProcessorBaseConstPtr findProcessor (const std::string &_processor_name) const
 Returns the processor with a given name (nullptr if not found) More...
 
ProcessorBasePtr findProcessor (const std::string &_processor_name)
 Returns the processor with a given name (nullptr if not found) More...
 
std::map< unsigned int, MotionProviderConstPtr > getMotionProviderMap () const
 Returns the motion providers indexed by their order. More...
 
std::map< unsigned int, MotionProviderPtr > getMotionProviderMap ()
 Returns the motion providers indexed by their order. More...
 
TrajectoryBaseConstPtr getTrajectory () const
 Returns the trajectory branch. More...
 
TrajectoryBasePtr getTrajectory ()
 Returns the trajectory branch. More...
 
bool isFirstFrameSpecified () const
 Returns whether the first frame options have been set. More...
 
bool isFirstFrameApplied () const
 Returns whether the first frame options have been applied (first frame emplaced) More...
 
void setFirstFrameOptions (const YAML::Node &_first_frame_node)
 Sets the first frame options (types, values and priors) from a YAML node. More...
 
void setFirstFrameOptions (const TypeComposite &_first_frame_types, const VectorComposite &_first_frame_values, const PriorComposite &_first_frame_priors)
 Sets the first frame options: types, values and priors. More...
 
FrameBasePtr applyFirstFrameOptions (const TimeStamp &_ts)
 Emplaces the first frame at _ts with the first frame options and calls the keyframe callback (only once) More...
 
FrameBasePtr emplaceFirstFrame (const TimeStamp &_ts, const YAML::Node &_first_frame_node)
 Sets the first frame options from a YAML node and applies them. More...
 
FrameBasePtr emplaceFirstFrame (const TimeStamp &_ts, const TypeComposite &_first_frame_types, const VectorComposite &_first_frame_values, const PriorComposite &_first_frame_priors)
 Sets the first frame options and applies them. More...
 
FrameBasePtr emplaceFrame (const TimeStamp &_time_stamp, const TypeComposite &_frame_types, const VectorComposite &_frame_state, const PriorComposite &_frame_priors={})
 Emplaces a frame from time stamp, types and state (adding the types to the problem) More...
 
FrameBasePtr emplaceFrame (const TimeStamp &_time_stamp, const StateKeys &_frame_keys)
 Emplaces a frame from time stamp and keys. More...
 
FrameBasePtr emplaceFrame (const TimeStamp &_time_stamp, const VectorComposite &_frame_state)
 Emplaces a frame from time stamp and state. More...
 
FrameBasePtr emplaceFrame (const TimeStamp &_time_stamp, const StateKeys &_frame_keys, const Eigen::VectorXd &_frame_state)
 Emplaces a frame from time stamp and state vector. More...
 
void emplaceStatesToFrame (FrameBasePtr _frame_ptr, const StateKeys &_frame_keys)
 Emplaces the missing states to a frame, with its time stamp. More...
 
void emplaceStatesToFrame (FrameBasePtr _frame_ptr, const VectorComposite &_frame_states)
 Emplaces the missing states to a frame. More...
 
FrameBaseConstPtr getLastFrame () const
 Returns the last frame of the trajectory. More...
 
FrameBasePtr getLastFrame ()
 Returns the last frame of the trajectory. More...
 
FrameBaseConstPtr closestFrameToTimeStamp (const TimeStamp &_ts) const
 Returns the frame of the trajectory closest to a time stamp. More...
 
FrameBasePtr closestFrameToTimeStamp (const TimeStamp &_ts)
 Returns the frame of the trajectory closest to a time stamp. More...
 
bool permitKeyFrame (ProcessorBaseConstPtr _processor_ptr) const
 Give the permission to a processor to create a new key Frame. More...
 
void keyFrameCallback (FrameBasePtr _keyframe_ptr, ProcessorBasePtr _processor_ptr)
 New keyframe callback. More...
 
TimeStamp getTimeStamp () const
 Returns the most recent time stamp of the motion providers (or of the last frame if none) More...
 
VectorComposite getState (const StateKeys &_keys) const
 Returns the current state of some keys, from the motion providers by order (completed with the last frame, the first frame options or zero) More...
 
VectorComposite getState (const TimeStamp &_ts, const StateKeys &_keys) const
 Returns the state of some keys at a time stamp, from the motion providers by order (completed with the closest frame, the first frame options or zero) More...
 
VectorComposite getOdometry (const StateKeys &_keys) const
 Returns the odometry of some keys, from the motion providers by order. More...
 
VectorComposite stateZero (TypeComposite _types) const
 Returns the zero (identity) state of some state types. More...
 
VectorComposite stateZero (const StateKeys &_keys) const
 Returns the zero (identity) state of some keys, with the frame state types. More...
 
MapBaseConstPtr getMap () const
 Returns the map branch. More...
 
MapBasePtr getMap ()
 Returns the map branch. More...
 
void setMap (MapBasePtr)
 Sets the map branch. More...
 
bool saveMap (const std::string &_filename_dot_yaml, const std::string &_map_name="Map automatically saved by Wolf")
 Saves the map to a YAML file. Returns whether it succeeded. More...
 
void perturb (double amplitude=0.01)
 Perturbs the non-fixed state blocks of all nodes with random noise following a uniform distribution in [-amplitude, amplitude] (in the tangent space) More...
 
void transform (const VectorComposite &_transformation)
 Transforms all the states of sensors, frames, captures and landmarks with a transformation. More...
 
bool isTransformed () const
 Returns whether the problem has been transformed (see transform()) More...
 
void resetTransformed ()
 Resets the transformed flag. More...
 
VectorComposite getTransformation () const
 Returns the last transformation applied to the problem. More...
 
void clearCovariance ()
 Clears all the covariance blocks. More...
 
void addCovarianceBlock (StateBlockPtr _state1, StateBlockPtr _state2, const Eigen::MatrixXd &_cov)
 Stores the cross-covariance block between two state blocks. More...
 
void addCovarianceBlock (StateBlockPtr _state1, const Eigen::MatrixXd &_cov)
 Stores the covariance block of a state block. More...
 
bool getCovarianceBlock (StateBlockConstPtr _state1, StateBlockConstPtr _state2, Eigen::MatrixXd &_cov, const int _row=0, const int _col=0) const
 Gets the cross-covariance block between two state blocks into _cov at (_row, _col). Returns whether it was found. More...
 
bool getCovarianceBlock (std::map< StateBlockConstPtr, unsigned int > _sb_2_idx, Eigen::MatrixXd &_cov) const
 Gets the covariance blocks of several state blocks into _cov, at the indices of _sb_2_idx. Returns whether all were found. More...
 
bool getCovarianceBlock (StateBlockConstPtr _state, Eigen::MatrixXd &_cov, const int _row_and_col=0) const
 Gets the covariance block of a state block into _cov at (_row_and_col, _row_and_col). Returns whether it was found. More...
 
bool getCovariance (NodeStateBlocksConstPtr _has_states_ptr, const StateKeys &_keys, Eigen::MatrixXd &_covariance) const
 Gets the covariance of some keys of a node. Returns whether all blocks were found. More...
 
bool getLastFrameCovariance (const StateKeys &_keys, Eigen::MatrixXd &_covariance) const
 Gets the covariance of some keys of the last frame. Returns whether all blocks were found. More...
 
StateBlockPtr notifyStateBlock (StateBlockPtr _state_ptr, Notification _notif)
 Notifies a new/removed state block to update the solver manager (opposite pending notifications cancel out) More...
 
SizeStd getStateBlockNotificationMapSize () const
 Returns the size of the map of state block notification. More...
 
bool getStateBlockNotification (const StateBlockPtr &sb_ptr, Notification &notif) const
 Returns whether the state block has been notified, and the notification via parameter. More...
 
FactorBasePtr notifyFactor (FactorBasePtr _factor_ptr, Notification _notif)
 Notifies a new/removed factor to update the solver manager (opposite pending notifications cancel out) More...
 
SizeStd getFactorNotificationMapSize () const
 Returns the size of the map of factor notification. More...
 
bool getFactorNotification (const FactorBasePtr &fac_ptr, Notification &notif) const
 Returns whether the factor has been notified, and the notification via parameter. More...
 
void print (int depth=4, bool factored_by=false, bool metric=true, bool state_blocks=false, std::ostream &stream=std::cout) const
 Prints the wolf tree. More...
 
bool check (int verbose_level=0) const
 Checks the consistency of the wolf tree, printing the result if verbose_level > 0. More...
 
bool check (bool verbose, std::ostream &stream) const
 Checks the consistency of the wolf tree, optionally printing the result to a stream. More...
 

Static Public Member Functions

static ProblemPtr create (SizeEigen _dim, const TypeComposite &_frame_types={}, LoaderPtr _loader=nullptr)
 Creates a problem from the dimension, the frame types and the plugin loader (use this as a constructor) More...
 
static ProblemPtr autoSetup (const std::string &_input_yaml_file, std::vector< std::string > _primary_schema_folders={}, LoaderPtr _loader=nullptr, bool _skip_yaml_validation=false)
 Creates a problem from a YAML file (see the YAML node version) More...
 
static ProblemPtr autoSetup (YAML::Node _param_node, std::vector< std::string > _primary_schema_folders={}, LoaderPtr _loader=nullptr, bool _skip_yaml_validation=false)
 Creates a problem from a YAML node, validated against the schemas (unless skipped): first frame options, tree manager, sensors, processors and map. More...
 

Protected Member Functions

void addFrameTypes (const TypeComposite &_types)
 Adds frame state types, checking that existing keys have the same type. More...
 
void addMotionProvider (MotionProviderPtr _processor_motion_ptr)
 Adds a motion provider to the motion providers (only if it is a state provider), by its order. More...
 
void removeMotionProvider (MotionProviderPtr proc)
 Removes a motion provider. More...
 
void consumeNotifications (std::map< StateBlockPtr, Notification > &, std::map< FactorBasePtr, Notification > &)
 Moves the state block and factor notifications to the given maps, to be handled by the solver (the maps stored in this are emptied) More...
 
std::map< StateBlockPtr, Notification > consumeStateBlockNotificationMap ()
 Returns the map of state block notification to be handled by the solver (the map stored in this is emptied). Declared but not implemented: use consumeNotifications() More...
 
std::map< FactorBasePtr, Notification > consumeFactorNotificationMap ()
 Returns the map of factor notification to be handled by the solver (the map stored in this is emptied). Declared but not implemented: use consumeNotifications() More...
 

Protected Attributes

HardwareBasePtr hardware_ptr_
 Hardware branch: the sensors and their processors. More...
 
TrajectoryBasePtr trajectory_ptr_
 Trajectory branch: the frames. More...
 
MapBasePtr map_ptr_
 Map branch: the landmarks. More...
 
TreeManagerBasePtr tree_manager_
 Tree manager. More...
 
std::map< unsigned int, MotionProviderPtr > motion_provider_map_
 Motion providers indexed by their order. More...
 
SizeEigen dim_
 Dimension of the problem (2 or 3) More...
 
TypeComposite frame_types_
 State types of the frames. More...
 
VectorComposite first_frame_values_
 State values of the first frame. More...
 
PriorComposite first_frame_priors_
 State priors of the first frame. More...
 
unsigned int first_frame_status_
 0: not set, 1: set, 2: applied More...
 
std::map< std::pair< StateBlockConstPtr, StateBlockConstPtr >, Eigen::MatrixXd > covariances_
 Covariance blocks, indexed by pairs of state blocks. More...
 
std::map< FactorBasePtr, Notification > factor_notification_map_
 Pending notifications to the solver. More...
 
std::map< StateBlockPtr, Notification > state_block_notification_map_
 Pending notifications to the solver. More...
 
std::mutex mut_notifications_
 Mutex of the notification maps. More...
 
std::mutex mut_covariances_
 Mutex of the covariances. More...
 
std::atomic_bool transformed_
 Whether the problem has been transformed (see transform()) More...
 
VectorComposite transformation_
 Last transformation applied to the problem. More...
 
std::mutex mut_transform_
 Mutex of the transformation. More...
 
LoaderPtr loader_
 Loader of the plugins. More...
 

Detailed Description

Wolf problem: root of the wolf tree (hardware, trajectory and map). It manages the motion providers, the first frame, the keyframe callbacks, the covariances and the notifications to the solver manager.

Constructor & Destructor Documentation

◆ ~Problem()

wolf::Problem::~Problem ( )
virtual

Destructor.

Member Function Documentation

◆ addCovarianceBlock() [1/2]

void wolf::Problem::addCovarianceBlock ( StateBlockPtr  _state1,
const Eigen::MatrixXd &  _cov 
)

Stores the covariance block of a state block.

◆ addCovarianceBlock() [2/2]

void wolf::Problem::addCovarianceBlock ( StateBlockPtr  _state1,
StateBlockPtr  _state2,
const Eigen::MatrixXd &  _cov 
)

Stores the cross-covariance block between two state blocks.

◆ addFrameTypes()

void wolf::Problem::addFrameTypes ( const TypeComposite &  _types)
protected

Adds frame state types, checking that existing keys have the same type.

◆ addMotionProvider()

void wolf::Problem::addMotionProvider ( MotionProviderPtr  _processor_motion_ptr)
protected

Adds a motion provider to the motion providers (only if it is a state provider), by its order.

◆ applyFirstFrameOptions()

FrameBasePtr wolf::Problem::applyFirstFrameOptions ( const TimeStamp &  _ts)

Emplaces the first frame at _ts with the first frame options and calls the keyframe callback (only once)

◆ autoSetup() [1/2]

ProblemPtr wolf::Problem::autoSetup ( const std::string &  _input_yaml_file,
std::vector< std::string >  _primary_schema_folders = {},
LoaderPtr  _loader = nullptr,
bool  _skip_yaml_validation = false 
)
static

Creates a problem from a YAML file (see the YAML node version)

◆ autoSetup() [2/2]

ProblemPtr wolf::Problem::autoSetup ( YAML::Node  _param_node,
std::vector< std::string >  _primary_schema_folders = {},
LoaderPtr  _loader = nullptr,
bool  _skip_yaml_validation = false 
)
static

Creates a problem from a YAML node, validated against the schemas (unless skipped): first frame options, tree manager, sensors, processors and map.

◆ check() [1/2]

bool wolf::Problem::check ( bool  verbose,
std::ostream &  stream 
) const

Checks the consistency of the wolf tree, optionally printing the result to a stream.

◆ check() [2/2]

bool wolf::Problem::check ( int  verbose_level = 0) const

Checks the consistency of the wolf tree, printing the result if verbose_level > 0.

◆ clearCovariance()

void wolf::Problem::clearCovariance ( )

Clears all the covariance blocks.

◆ closestFrameToTimeStamp() [1/2]

FrameBasePtr wolf::Problem::closestFrameToTimeStamp ( const TimeStamp &  _ts)

Returns the frame of the trajectory closest to a time stamp.

◆ closestFrameToTimeStamp() [2/2]

FrameBaseConstPtr wolf::Problem::closestFrameToTimeStamp ( const TimeStamp &  _ts) const

Returns the frame of the trajectory closest to a time stamp.

◆ consumeFactorNotificationMap()

std::map< FactorBasePtr, Notification > wolf::Problem::consumeFactorNotificationMap ( )
protected

Returns the map of factor notification to be handled by the solver (the map stored in this is emptied). Declared but not implemented: use consumeNotifications()

◆ consumeNotifications()

void wolf::Problem::consumeNotifications ( std::map< StateBlockPtr, Notification > &  _sb_notification_map,
std::map< FactorBasePtr, Notification > &  _fac_notification_map 
)
inlineprotected

Moves the state block and factor notifications to the given maps, to be handled by the solver (the maps stored in this are emptied)

◆ consumeStateBlockNotificationMap()

std::map< StateBlockPtr, Notification > wolf::Problem::consumeStateBlockNotificationMap ( )
protected

Returns the map of state block notification to be handled by the solver (the map stored in this is emptied). Declared but not implemented: use consumeNotifications()

◆ create()

ProblemPtr wolf::Problem::create ( SizeEigen  _dim,
const TypeComposite &  _frame_types = {},
LoaderPtr  _loader = nullptr 
)
static

Creates a problem from the dimension, the frame types and the plugin loader (use this as a constructor)

◆ emplaceFirstFrame() [1/2]

FrameBasePtr wolf::Problem::emplaceFirstFrame ( const TimeStamp &  _ts,
const TypeComposite &  _first_frame_types,
const VectorComposite &  _first_frame_values,
const PriorComposite &  _first_frame_priors 
)

Sets the first frame options and applies them.

◆ emplaceFirstFrame() [2/2]

FrameBasePtr wolf::Problem::emplaceFirstFrame ( const TimeStamp &  _ts,
const YAML::Node &  _first_frame_node 
)

Sets the first frame options from a YAML node and applies them.

◆ emplaceFrame() [1/4]

FrameBasePtr wolf::Problem::emplaceFrame ( const TimeStamp &  _time_stamp,
const StateKeys &  _frame_keys 
)

Emplaces a frame from time stamp and keys.

Parameters
_time_stampTime stamp of the frame
_frame_keysString containing the keys of the desired frame.
  • The frame_types are taken from Problem
  • The states are taken from Problem::getState(_time_stamp, _frame_keys)

This acts as a Frame factory, but also takes care to update related lists in WolfProblem:

  • Create a Frame
  • Add it to Trajectory (notifying its state blocks to the problem)

◆ emplaceFrame() [2/4]

FrameBasePtr wolf::Problem::emplaceFrame ( const TimeStamp &  _time_stamp,
const StateKeys &  _frame_keys,
const Eigen::VectorXd &  _frame_state 
)

Emplaces a frame from time stamp and state vector.

Parameters
_time_stampTime stamp of the frame
_frame_keysString containing the keys of the desired frame.
_frame_stateState vector; must match the size and format of the chosen frame state_keys
  • The frame_types are taken from Problem

This acts as a Frame factory, but also takes care to update related lists in WolfProblem:

  • Create a Frame
  • Add it to Trajectory (notifying its state blocks to the problem)

◆ emplaceFrame() [3/4]

FrameBasePtr wolf::Problem::emplaceFrame ( const TimeStamp &  _time_stamp,
const TypeComposite &  _frame_types,
const VectorComposite &  _frame_state,
const PriorComposite &  _frame_priors = {} 
)

Emplaces a frame from time stamp, types and state (adding the types to the problem)

Parameters
_time_stampTime stamp of the frame
_frame_typesTypeComposite indicating the types of each key.
_frame_stateVectorComposite with the states
_frame_priorsPriorComposite with the priors on the states (not all keys required)

This acts as a Frame factory, but also takes care to update related lists in WolfProblem:

  • Create a Frame
  • Add it to Trajectory (notifying its state blocks to the problem)

◆ emplaceFrame() [4/4]

FrameBasePtr wolf::Problem::emplaceFrame ( const TimeStamp &  _time_stamp,
const VectorComposite &  _frame_state 
)

Emplaces a frame from time stamp and state.

Parameters
_time_stampTime stamp of the frame
_frame_stateState; must be part of the problem's frame state_keys
  • The frame_types are taken from Problem

This acts as a Frame factory, but also takes care to update related lists in WolfProblem:

  • Create a Frame
  • Add it to Trajectory (notifying its state blocks to the problem)

◆ emplaceStatesToFrame() [1/2]

void wolf::Problem::emplaceStatesToFrame ( FrameBasePtr  _frame_ptr,
const StateKeys &  _frame_keys 
)

Emplaces the missing states to a frame, with its time stamp.

Parameters
_frame_ptrFrame to which states have to be emplaced
_frame_keysthe keys that the frame is requested to have.
  • The frame_types are taken from Problem.
  • Only the missing keys are emplaced.
  • The states are taken from Problem::getState(_frame_ptr->getTimeStamp(), _frame_keys)
  • The states are emplaced to the frame as unfixed.

◆ emplaceStatesToFrame() [2/2]

void wolf::Problem::emplaceStatesToFrame ( FrameBasePtr  _frame_ptr,
const VectorComposite &  _frame_states 
)

Emplaces the missing states to a frame.

Parameters
_frame_ptrFrame to which states have to be emplaced
_frame_statesthe states vectors to be added to the frame
  • The frame_types are taken from Problem.
  • Only the missing keys are emplaced.
  • The states are emplaced to the frame as unfixed.

◆ findProcessor() [1/2]

ProcessorBasePtr wolf::Problem::findProcessor ( const std::string &  _processor_name)

Returns the processor with a given name (nullptr if not found)

◆ findProcessor() [2/2]

ProcessorBaseConstPtr wolf::Problem::findProcessor ( const std::string &  _processor_name) const

Returns the processor with a given name (nullptr if not found)

Parameters
_processor_nameThe processor name, as it was installed with installProcessor()

◆ findSensor() [1/2]

SensorBasePtr wolf::Problem::findSensor ( const std::string &  _sensor_name)

Returns the sensor with a given name (nullptr if not found)

◆ findSensor() [2/2]

SensorBaseConstPtr wolf::Problem::findSensor ( const std::string &  _sensor_name) const

Returns the sensor with a given name (nullptr if not found)

Parameters
_sensor_nameThe sensor name, as it was installed with installSensor()

◆ getCovariance()

bool wolf::Problem::getCovariance ( NodeStateBlocksConstPtr  _has_states_ptr,
const StateKeys &  _keys,
Eigen::MatrixXd &  _covariance 
) const

Gets the covariance of some keys of a node. Returns whether all blocks were found.

◆ getCovarianceBlock() [1/3]

bool wolf::Problem::getCovarianceBlock ( StateBlockConstPtr  _state,
Eigen::MatrixXd &  _cov,
const int  _row_and_col = 0 
) const

Gets the covariance block of a state block into _cov at (_row_and_col, _row_and_col). Returns whether it was found.

◆ getCovarianceBlock() [2/3]

bool wolf::Problem::getCovarianceBlock ( StateBlockConstPtr  _state1,
StateBlockConstPtr  _state2,
Eigen::MatrixXd &  _cov,
const int  _row = 0,
const int  _col = 0 
) const

Gets the cross-covariance block between two state blocks into _cov at (_row, _col). Returns whether it was found.

◆ getCovarianceBlock() [3/3]

bool wolf::Problem::getCovarianceBlock ( std::map< StateBlockConstPtr, unsigned int >  _sb_2_idx,
Eigen::MatrixXd &  _cov 
) const

Gets the covariance blocks of several state blocks into _cov, at the indices of _sb_2_idx. Returns whether all were found.

◆ getDim()

SizeEigen wolf::Problem::getDim ( ) const

Returns the dimension of the problem (2 or 3)

◆ getFactorNotification()

bool wolf::Problem::getFactorNotification ( const FactorBasePtr &  fac_ptr,
Notification &  notif 
) const

Returns whether the factor has been notified, and the notification via parameter.

◆ getFactorNotificationMapSize()

wolf::SizeStd wolf::Problem::getFactorNotificationMapSize ( ) const
inline

Returns the size of the map of factor notification.

◆ getFrameTypes()

TypeComposite wolf::Problem::getFrameTypes ( StateKeys  _keys) const

Returns the frame state types of some keys.

◆ getHardware() [1/2]

HardwareBasePtr wolf::Problem::getHardware ( )

Returns the hardware branch.

◆ getHardware() [2/2]

HardwareBaseConstPtr wolf::Problem::getHardware ( ) const

Returns the hardware branch.

◆ getLastFrame() [1/2]

FrameBasePtr wolf::Problem::getLastFrame ( )

Returns the last frame of the trajectory.

◆ getLastFrame() [2/2]

FrameBaseConstPtr wolf::Problem::getLastFrame ( ) const

Returns the last frame of the trajectory.

◆ getLastFrameCovariance()

bool wolf::Problem::getLastFrameCovariance ( const StateKeys &  _keys,
Eigen::MatrixXd &  _covariance 
) const

Gets the covariance of some keys of the last frame. Returns whether all blocks were found.

◆ getLoader()

LoaderPtr wolf::Problem::getLoader ( )
inline

Returns the plugin loader.

◆ getMap() [1/2]

MapBasePtr wolf::Problem::getMap ( )

Returns the map branch.

◆ getMap() [2/2]

MapBaseConstPtr wolf::Problem::getMap ( ) const

Returns the map branch.

◆ getMotionProviderMap() [1/2]

std::map< unsigned int, MotionProviderPtr > wolf::Problem::getMotionProviderMap ( )
inline

Returns the motion providers indexed by their order.

◆ getMotionProviderMap() [2/2]

std::map< unsigned int, MotionProviderConstPtr > wolf::Problem::getMotionProviderMap ( ) const
inline

Returns the motion providers indexed by their order.

◆ getOdometry()

VectorComposite wolf::Problem::getOdometry ( const StateKeys &  _keys) const

Returns the odometry of some keys, from the motion providers by order.

◆ getState() [1/2]

VectorComposite wolf::Problem::getState ( const StateKeys &  _keys) const

Returns the current state of some keys, from the motion providers by order (completed with the last frame, the first frame options or zero)

◆ getState() [2/2]

VectorComposite wolf::Problem::getState ( const TimeStamp &  _ts,
const StateKeys &  _keys 
) const

Returns the state of some keys at a time stamp, from the motion providers by order (completed with the closest frame, the first frame options or zero)

◆ getStateBlockNotification()

bool wolf::Problem::getStateBlockNotification ( const StateBlockPtr &  sb_ptr,
Notification &  notif 
) const

Returns whether the state block has been notified, and the notification via parameter.

◆ getStateBlockNotificationMapSize()

SizeStd wolf::Problem::getStateBlockNotificationMapSize ( ) const
inline

Returns the size of the map of state block notification.

◆ getTimeStamp()

TimeStamp wolf::Problem::getTimeStamp ( ) const

Returns the most recent time stamp of the motion providers (or of the last frame if none)

◆ getTrajectory() [1/2]

TrajectoryBasePtr wolf::Problem::getTrajectory ( )

Returns the trajectory branch.

◆ getTrajectory() [2/2]

TrajectoryBaseConstPtr wolf::Problem::getTrajectory ( ) const

Returns the trajectory branch.

◆ getTransformation()

VectorComposite wolf::Problem::getTransformation ( ) const

Returns the last transformation applied to the problem.

◆ getTreeManager() [1/2]

TreeManagerBasePtr wolf::Problem::getTreeManager ( )
inline

Returns the tree manager.

◆ getTreeManager() [2/2]

TreeManagerBaseConstPtr wolf::Problem::getTreeManager ( ) const
inline

Returns the tree manager.

◆ installProcessor() [1/3]

ProcessorBasePtr wolf::Problem::installProcessor ( const std::string &  _params_yaml_filename,
std::vector< std::string >  _schema_folders 
)

Installs a processor (creates it and links it to the sensor named in 'sensor_name') from a YAML file.

Parameters
_params_yaml_filenamename of formatted yaml file defining the processor parameters.
_schema_foldersa vector of paths where the schema files (to validate the YAML file) are placed

◆ installProcessor() [2/3]

ProcessorBasePtr wolf::Problem::installProcessor ( SensorBasePtr  _sensor_corresponding,
const std::string &  _params_yaml_filename,
std::vector< std::string >  _schema_folders 
)

Installs a processor (creates it and links it to the given sensor) from a YAML file.

Parameters
_sensor_correspondingcorresponding sensor pointer, used to bind the processor to the particular instance of the sensor
_params_yaml_filenamename of formatted yaml file defining the processor parameters.
_schema_foldersa vector of paths where the schema files (to validate the YAML file) are placed

◆ installProcessor() [3/3]

ProcessorBasePtr wolf::Problem::installProcessor ( YAML::Node  _processor_node,
std::vector< std::string >  _schema_folders = {} 
)

Installs a processor (creates it and links it to the sensor named in 'sensor_name') from a YAML node, loading its plugin if needed.

Parameters
_processor_nodeYAML node containing all necessary information to call the factory and create the processor.
_schema_foldersa vector of paths where the schema files (to validate the YAML node) are placed, if empty the node is not validated.

◆ installSensor() [1/2]

SensorBasePtr wolf::Problem::installSensor ( const std::string &  _params_yaml_filename,
std::vector< std::string >  _schema_folders 
)

Installs a sensor (creates it and links it to the hardware) from a YAML file.

Parameters
_params_yaml_filenamethe name of the YAML file with the sensor parameters (type, plugin, name, etc.)
_schema_foldersa vector of paths where the schema files (to validate the YAML file) are placed

◆ installSensor() [2/2]

SensorBasePtr wolf::Problem::installSensor ( YAML::Node  _sensor_node,
std::vector< std::string >  _schema_folders = {} 
)

Installs a sensor (creates it and links it to the hardware) from a YAML node, loading its plugin if needed.

Parameters
_sensor_nodeYAML node containing all necessary information to call the factory and create the sensor.
_schema_foldersa vector of paths where the schema files (to validate the YAML node) are placed, if empty the node is not validated.

◆ isFirstFrameApplied()

bool wolf::Problem::isFirstFrameApplied ( ) const
inline

Returns whether the first frame options have been applied (first frame emplaced)

◆ isFirstFrameSpecified()

bool wolf::Problem::isFirstFrameSpecified ( ) const
inline

Returns whether the first frame options have been set.

◆ isTransformed()

bool wolf::Problem::isTransformed ( ) const

Returns whether the problem has been transformed (see transform())

◆ keyFrameCallback()

void wolf::Problem::keyFrameCallback ( FrameBasePtr  _keyframe_ptr,
ProcessorBasePtr  _processor_ptr 
)

New keyframe callback.

It should be called by any processor that creates a new keyframe. It calls the keyFrameCallback() of the rest of processors and of the tree manager.

◆ notifyFactor()

FactorBasePtr wolf::Problem::notifyFactor ( FactorBasePtr  _factor_ptr,
Notification  _notif 
)

Notifies a new/removed factor to update the solver manager (opposite pending notifications cancel out)

◆ notifyStateBlock()

StateBlockPtr wolf::Problem::notifyStateBlock ( StateBlockPtr  _state_ptr,
Notification  _notif 
)

Notifies a new/removed state block to update the solver manager (opposite pending notifications cancel out)

◆ permitKeyFrame()

bool wolf::Problem::permitKeyFrame ( ProcessorBaseConstPtr  _processor_ptr) const

Give the permission to a processor to create a new key Frame.

This should implement a black list of processors that have forbidden key frame creation.

  • This decision is made at problem level, not at processor configuration level.
  • Therefore, if you want to permanently configure a processor for not creating key frames, see Processor::voting_active_ and its accessors.

◆ perturb()

void wolf::Problem::perturb ( double  amplitude = 0.01)

Perturbs the non-fixed state blocks of all nodes with random noise following a uniform distribution in [-amplitude, amplitude] (in the tangent space)

◆ print()

void wolf::Problem::print ( int  depth = 4,
bool  factored_by = false,
bool  metric = true,
bool  state_blocks = false,
std::ostream &  stream = std::cout 
) const

Prints the wolf tree.

Parameters
depthlevels to show ( 0: H, T, M : 1: H:S, T:F, M:L ; 2: H:S:p, T:F:C ; 3: T:F:C:f ; 4: T:F:C:f:c )
factored_byshow factors pointing to F, C, f and L.
metricshow metric info (status, time stamps, state vectors, measurements)
state_blocksshow state blocks

◆ removeMotionProvider()

void wolf::Problem::removeMotionProvider ( MotionProviderPtr  proc)
protected

Removes a motion provider.

◆ resetTransformed()

void wolf::Problem::resetTransformed ( )

Resets the transformed flag.

◆ saveMap()

bool wolf::Problem::saveMap ( const std::string &  _filename_dot_yaml,
const std::string &  _map_name = "Map automatically saved by Wolf" 
)

Saves the map to a YAML file. Returns whether it succeeded.

◆ setFirstFrameOptions() [1/2]

void wolf::Problem::setFirstFrameOptions ( const TypeComposite &  _first_frame_types,
const VectorComposite &  _first_frame_values,
const PriorComposite &  _first_frame_priors 
)

Sets the first frame options: types, values and priors.

◆ setFirstFrameOptions() [2/2]

void wolf::Problem::setFirstFrameOptions ( const YAML::Node &  _first_frame_node)

Sets the first frame options (types, values and priors) from a YAML node.

◆ setMap()

void wolf::Problem::setMap ( MapBasePtr  _map_ptr)

Sets the map branch.

◆ setTreeManager()

void wolf::Problem::setTreeManager ( TreeManagerBasePtr  _gm)

Sets the tree manager.

◆ stateZero() [1/2]

VectorComposite wolf::Problem::stateZero ( const StateKeys &  _keys) const

Returns the zero (identity) state of some keys, with the frame state types.

◆ stateZero() [2/2]

VectorComposite wolf::Problem::stateZero ( TypeComposite  _types) const

Returns the zero (identity) state of some state types.

◆ transform()

void wolf::Problem::transform ( const VectorComposite &  _transformation)

Transforms all the states of sensors, frames, captures and landmarks with a transformation.

Member Data Documentation

◆ covariances_

std::map<std::pair<StateBlockConstPtr, StateBlockConstPtr>, Eigen::MatrixXd> wolf::Problem::covariances_
protected

Covariance blocks, indexed by pairs of state blocks.

◆ dim_

SizeEigen wolf::Problem::dim_
protected

Dimension of the problem (2 or 3)

◆ factor_notification_map_

std::map<FactorBasePtr, Notification> wolf::Problem::factor_notification_map_
protected

Pending notifications to the solver.

◆ first_frame_priors_

PriorComposite wolf::Problem::first_frame_priors_
protected

State priors of the first frame.

◆ first_frame_status_

unsigned int wolf::Problem::first_frame_status_
protected

0: not set, 1: set, 2: applied

◆ first_frame_values_

VectorComposite wolf::Problem::first_frame_values_
protected

State values of the first frame.

◆ frame_types_

TypeComposite wolf::Problem::frame_types_
protected

State types of the frames.

◆ hardware_ptr_

HardwareBasePtr wolf::Problem::hardware_ptr_
protected

Hardware branch: the sensors and their processors.

◆ loader_

LoaderPtr wolf::Problem::loader_
protected

Loader of the plugins.

◆ map_ptr_

MapBasePtr wolf::Problem::map_ptr_
protected

Map branch: the landmarks.

◆ motion_provider_map_

std::map<unsigned int, MotionProviderPtr> wolf::Problem::motion_provider_map_
protected

Motion providers indexed by their order.

◆ mut_covariances_

std::mutex wolf::Problem::mut_covariances_
mutableprotected

Mutex of the covariances.

◆ mut_notifications_

std::mutex wolf::Problem::mut_notifications_
mutableprotected

Mutex of the notification maps.

◆ mut_transform_

std::mutex wolf::Problem::mut_transform_
mutableprotected

Mutex of the transformation.

◆ state_block_notification_map_

std::map<StateBlockPtr, Notification> wolf::Problem::state_block_notification_map_
protected

Pending notifications to the solver.

◆ trajectory_ptr_

TrajectoryBasePtr wolf::Problem::trajectory_ptr_
protected

Trajectory branch: the frames.

◆ transformation_

VectorComposite wolf::Problem::transformation_
protected

Last transformation applied to the problem.

◆ transformed_

std::atomic_bool wolf::Problem::transformed_
protected

Whether the problem has been transformed (see transform())

◆ tree_manager_

TreeManagerBasePtr wolf::Problem::tree_manager_
protected

Tree manager.


The documentation for this class was generated from the following files: